#!/bin/sh

if [ "$1" = "help" ]; then
    echo "*** Description ***" 
    echo "Download a song or album from youtube, stores them in the \`~/Music\` directory"
    echo ""
    echo "*** Usage ***"
    echo "ytdl <song|album> <url> [album name]"
    echo ""
    echo "*** Parameters ***"
    echo "album name: Name of the folder to create when downloading songs, only available if the \`album\` option is enabled"
    echo ""
    echo "*** Options ***"
    echo "song: Download url as song"
    echo "album: Download url as album"
    echo "url: Url to Youtube video to download"
    echo ""
    exit 0
fi

echo "TODO: Finish then by finding out how to control where params are passed(ex: all params after 2)"
exit 1

if [ "$1" = "song" ]; then
    youtube-dl --extract-audio --embbed-thumbnail --no-playlist --audio-quality 0 --audio-format mp3 -o "$HOME/Music/%(title)s.%(ext)s"
elif [ "$1" = "album" ]; then
    mkdir ~/Music/"$2"
    youtube-dl --extract-audio --embbed-thumbnail --yes-playlist --audio-quality 0 --audio-format mp3 -o "$HOME/Music/$2/%(title)s.%(ext)s" "$*"
fi

